﻿using Abp.Configuration.Startup;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace App.Web.Controllers
{
    public class LoadViewController : AppMvcControllerBase
    {
        private readonly IMultiTenancyConfig _multiTenancyConfig;

        public LoadViewController(
            IMultiTenancyConfig multiTenancyConfig)
        {
            _multiTenancyConfig = multiTenancyConfig;
        }

        // GET: LoadView
        public ActionResult Index()
        {
            var viewUrl = Request["viewUrl"];
            if (!string.IsNullOrEmpty(viewUrl) && viewUrl.StartsWith("app/")) {
                viewUrl = "~/admin/"+ viewUrl;
            }

            ViewBag.TenantId = AbpSession.TenantId;
            ViewBag.IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled;

            return View(viewUrl);
        }
    }
}